<?php
include('rootlogin.php');
//include('../incsession.php');
session_start();


mysql_query("SET NAMES 'utf8'");
?>

<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="framestyle.css" type="text/css" media="screen">
<style type="text/css">

</style>
</head>


<body>

<div id="wrapper">
<div id="title">Online Listening Comprehension Program</div>

<div id="main">
<hr/>
<div id="title2">EDIT CLASS STATES</div>
<hr/>
<br><br>
<form method = POST action="edit_class2.php" >
<table>
<tr bgcolor="CCCCCC">
<td width=40px align="center"><input type='checkbox' onClick="javascript:select_all()">
<td width=60px align="center"><font color="FFFFFF" size=4>YEAR</font>
<td width=110px align="center"><font color="FFFFFF" size=4>SEMESTER</font>
<td width=250px align="center"><font color="FFFFFF" size=4>TEACHER</font>
<td width=250px align="center"><font color="FFFFFF" size=4>CLASS NAME</font>
<td width=90px align="center"><font color="FFFFFF" size=4>STATE</font>
<?php
$query="SELECT * FROM class ORDER BY year DESC, semester";
$result = mysql_query($query,$user_con);
$valid;
$i=0;
while($row[$i] = mysql_fetch_array($result)){
	if($row[$i]['valid']==0)
		$valid="expired";
	else
		$valid="valid";
	/*if($row['semester']==0)
		$semester="fall";
	else
		$semester="spring";*/
	echo "<tr><td align='center'><div id='check_".$i."'><input type='checkbox' value=".$row[$i]['classid']." name='class[]'></div><td>".$row[$i]['year']."<td>".$row[$i]['semester']."<td>".$row[$i]['teacher']."<td>".$row[$i]['name']."<td>".$valid;	
	$i++;
}
?>
</table>
<script>

function select_all(){
<?php

for($i=0; $i<sizeof($row[$i]); $i++){
	echo "document.getElementById('check_".$i."').innerHTML='<input type=\"checkbox\" value=".$row[$i]['classid']." name=\"class[]\" checked >';";	
}
?>

}
</script>
<br>
<div class="btn_right"><input type="submit" name = "submit" value = "next"></div>
</form>

<form method = POST action="index.php" >
<div class="btn_right"><input type="submit" name = "submit" value = "back to index"></div>
</form>
</div>
</div>
</body>

